/****** Object:  Stored Procedure dbo.CGO_GameEnrollmentGet    Script Date: Sunday, March 06, 2011 ******/
IF EXISTS ( SELECT  *
            FROM    dbo.sysobjects
            WHERE   id = OBJECT_ID(N'dbo.CGO_GameEnrollmentGet')
                    AND OBJECTPROPERTY(id, N'IsProcedure') = 1 ) 
  DROP PROCEDURE dbo.CGO_GameEnrollmentGet
GO

/* -------------------------------------------------------------------------------------
/   GameEnrollmentGet
/  ------------------------------------------------------------------------------------- */
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS OFF 
GO

CREATE PROCEDURE dbo.CGO_GameEnrollmentGet
  @PortalID INT ,
  @EnrollmentID INT
AS 
  SELECT  EnrollmentID ,
          M.PortalID ,
          M.EventID ,
          E.Name AS EventName ,
          M.GameID ,
          G.Name AS GameName ,
          M.UserID ,
          U.Username,
          M.EnrollStatusID ,
          S.StatusDesc AS EnrollStatus,
          M.EnrollFee ,
          StartTime ,
          EndTime ,
          ConnectCount ,
          Score ,
          M.CreatedDate ,
          M.LastUpdateDate
  FROM    dbo.CGO_GameEnrollment M
  LEFT JOIN dbo.CGO_GameEnrollmentStatus S ON M.EnrollStatusID = S.StatusID
  LEFT JOIN dbo.Users U ON M.UserID = U.UserID
  LEFT JOIN dbo.CGO_Game G ON M.GameID = G.GameID
  LEFT JOIN dbo.CGO_Event E ON M.EventID = E.EventID
  WHERE   M.PortalID = @PortalID
          AND M.EnrollmentID = @EnrollmentID
	
GO

SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO
